const mongoose=require('mongoose');
const articleSchema=new mongoose.Schema({
    title:{
        type:String,
        maxlength:20,
        minlength:2,
        required:[true,'请填写文章标题']
    },
    author:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'user',
        required: [true,'请填写作者']
    },
    pubishDate:{
        type:Date,
        default:Date.now
    },
    cover:{
        type:String,
        default:null
    },
    content:{
        type:String
    }
});
const article=mongoose.model('article',articleSchema);
// console.log(mongoose.Schema.Types.ObjectId);
module.exports={
    article
}